﻿using System;
using System.ComponentModel.DataAnnotations;
using Viettel.VOFFICE.DAO.Models;

namespace Viettel.VOFFICE.Web.Models
{
    public class TodoModel : BaseModel
    {
        public TodoModel() { }
        public TodoModel(Todo todo)
        {
            Id = todo.Id;
            Name = todo.Name;
            Description = todo.Description;
            NodeId = todo.NodeId;
            IsActive = todo.IsActive;
            IsCheckList = todo.IsCheckList;
            DocTemplate = todo.DocTemplate;
            CreatedAt = todo.CreatedAt;
            UpdatedAt = todo.UpdatedAt;
            CreatorId = todo.CreatorId;
            LibraryId = todo.LibraryId;
            if (todo.LibraryId != null)
            {
                LibraryItemName = todo.Library.Name;
            }
            NodeName = todo.Node.Name;
        }
        public int Id { get; set; }

        [Required(ErrorMessageResourceType = typeof(Resources.Resources), ErrorMessageResourceName = "region")]
        public string Name { get; set; }

        public string Description { get; set; }

        [Required(ErrorMessageResourceType = typeof(Resources.Resources), ErrorMessageResourceName = "region")]
        [Range(1, int.MaxValue, ErrorMessageResourceType = typeof(Resources.Resources), ErrorMessageResourceName = "region")]
        public int NodeId { get; set; }

        public string NodeName { get; set; }

        public bool? IsActive { get; set; }
        public bool IsCheckList { get; set; }
        public string DocTemplate { get; set; }
        public DateTime CreatedAt { get; set; }
        public DateTime UpdatedAt { get; set; }
        public Guid? CreatorId { get; set; }
        public int? LibraryId { get; set; }
        public string LibraryItemName { get; set; }
    }
}